#ifndef BYTECODEZZ_COMPRESSORJPEG_H
#define BYTECODEZZ_COMPRESSORJPEG_H

#include <jni.h>
#include <string>
#include <stdio.h>
#include <jpeglib.h>
#include <malloc.h>
#include <android/bitmap.h>
#include <compressorConfigure.h>
#include <jnicallbackhelper.h>
#include <pthread.h>


class compressorjpeg {
private:
    char *outputPath = nullptr; //指针赋初始值，习惯养成
    jobject rawBitmap = nullptr; //指针赋初始值，习惯养成
    int quality = 0;
    pthread_t pid;
    jnicallbackhelper *helper = 0;

public:
    compressorjpeg(jobject, const char *, int, jnicallbackhelper *);

    virtual ~compressorjpeg();

    void compressor(bool openChild);

    void runnable_compressor(int thread_mode);

    void
    writeJpegToFile(uint8_t *temp, int width, int height, jint quality, const char *outPutPath);

    void handlerData(jobject bitmap, jint quality, const char *outPutPath);

};


#endif //BYTECODEZZ_COMPRESSORJPEG_H
